package effectiveCode.builder;

import lombok.Data;

/**
 * @author： pang-yun
 * @date： 2022-01-10 13:34
 * 功能目的 ：用于
 */
@Data
public class Dog {
    private int id;
    private String name;
    private int weight;


    public Dog(Builder builder) {
        this.id = builder.id;
        this.name = builder.name;
        this.weight = builder.weight;
    }

    public static class Builder {
        private int id;
        private String name;
        private int weight;

        public Builder(int id, String name) {
            this.id = id;
            this.name = name;
        }

        public Builder weight(int weight) {
            this.weight = weight;
            return this;
        }


        public Dog build(){
            return new Dog(this);
        }
    }
}
